"use strict";
const common_vendor = require("../../../../common/vendor.js");
if (!Array) {
  const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon");
  const _easycom_u_button2 = common_vendor.resolveComponent("u-button");
  (_easycom_u_icon2 + _easycom_u_button2)();
}
const _easycom_u_icon = () => "../../../../node-modules/uview-plus/components/u-icon/u-icon.js";
const _easycom_u_button = () => "../../../../node-modules/uview-plus/components/u-button/u-button.js";
if (!Math) {
  (_easycom_u_icon + _easycom_u_button)();
}
const _sfc_main = {
  __name: "Gpt",
  setup(__props) {
    const roles = ["system", "patient"];
    const selectedRole = common_vendor.ref("0");
    const newMessage = common_vendor.ref("");
    const messages = common_vendor.ref([
      { text: "您好，我是精通高血压知识的智能问答小助手，您可以直接向我提问哦~", role: "system" },
      {
        text: "",
        role: "system",
        suggestions: ["高血压是什么？", "如何预防高血压？", "高血压在饮食上要注意什么？"]
      }
    ]);
    const sendMessage = () => {
      if (newMessage.value.trim() === "")
        return;
      const role = roles[Number(selectedRole.value)];
      messages.value.push({ text: newMessage.value, role });
      newMessage.value = "";
    };
    const sendSuggestion = (suggestion) => {
      messages.value.push({ text: suggestion, role: "patient" });
    };
    const refreshSuggestions = () => {
    };
    return (_ctx, _cache) => {
      return {
        a: common_vendor.f(messages.value, (message, index, i0) => {
          return common_vendor.e({
            a: common_vendor.t(message.text),
            b: message.suggestions
          }, message.suggestions ? {
            c: common_vendor.o(refreshSuggestions, index),
            d: "812126a2-0-" + i0,
            e: common_vendor.p({
              name: "reload",
              color: "rgb(44, 84, 246)"
            }),
            f: common_vendor.f(message.suggestions, (suggestion, idx, i1) => {
              return {
                a: common_vendor.t(suggestion),
                b: idx,
                c: common_vendor.o(($event) => sendSuggestion(suggestion), idx)
              };
            })
          } : {}, {
            g: index,
            h: common_vendor.n(message.role)
          });
        }),
        b: newMessage.value,
        c: common_vendor.o(($event) => newMessage.value = $event.detail.value),
        d: common_vendor.o(sendMessage),
        e: common_vendor.p({
          type: "primary"
        })
      };
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-812126a2"]]);
wx.createPage(MiniProgramPage);
